package com.jt.assistant.adapter

import android.annotation.SuppressLint
import android.graphics.Color
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jt.assistant.R
import com.jt.assistant.bean.CartonGoodsList

class RunturnSkuUploadAdapter(mData: MutableList<CartonGoodsList>) :
    BaseQuickAdapter<CartonGoodsList, BaseViewHolder>(
        R.layout.item_layout_return_upload, mData
    ) {

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: CartonGoodsList) {
        val content = holder.getView<TextView>(R.id.tv_content)
        val num = holder.getView<TextView>(R.id.tv_num)
        content.text = item.sku
        num.text = item.num
        if (mErrorSku.isNotEmpty() && mErrorSku == item.sku) {
            content.setTextColor(Color.RED)
            num.setTextColor(Color.RED)
        } else {
            content.setTextColor(Color.GRAY)
            num.setTextColor(Color.GRAY)
        }


    }

    var mErrorSku = ""
    fun setErrorCode(errorSku: String) {
        mErrorSku = errorSku
        notifyDataSetChanged()
    }

}